package com.wang.模式.创建.单例;

/**
 * @author wang
 * @Description
 * @create 2021-10-12 17:16
 */
public class SingletonTest07 {
    public static void main(String[] args) {
        Singleton7 instance = Singleton7.getInstance();
        Singleton7 instance1 = Singleton7.getInstance();
        System.out.println(instance);
        System.out.println(instance1);
    }

}
class Singleton7{
    private static volatile Singleton7 instance;

    private Singleton7() {
    }
    private static class SingtonInstance{
        private static final Singleton7 INSTANCE = new Singleton7();
    }
    public static Singleton7 getInstance(){
        return SingtonInstance.INSTANCE;
    }
}
